<template>
	<view>
		<!-- 互转 -->
		<cus-navbar ref="navbar" navbar :title="$t('index37')"></cus-navbar>
		<view class="main-padding">
			<view class="gap-30"></view>
			<view class="main-card">
				<!-- 发送地址 -->
				<view class="size-28">{{$t('index69')}}</view>
				<view class="with-card flex justify-between align-center mt-24">
					<!-- 请输入发送地址 -->
					<input type="text" v-model="address" :placeholder="$t('index70')" placeholder-class="color-71 size-26" class="flex-1 size-26" />
				</view>
				<!-- 发送金额 -->
				<view class="size-28 mt-30">{{$t('index71')}}</view>
				<view class="with-card flex justify-between align-center mt-24">
					<!-- 请输入互转金额 -->
					<input type="digit" v-model="price" :placeholder="$t('index72')" placeholder-class="color-71 size-26" class="flex-1 size-26" />
					<view class="size-26">AFH</view>
				</view>
			</view>
			<view class="gap-300"></view>
			<!-- 确认 -->
			<button class="main-btn" @click="submit">{{$t('index73')}}</button>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				price:'',
				address:''
			}
		},
		onLoad(){
			this.loadData()
		},
		methods:{
			loadData(){},
			submit(){
				if(!this.address){
					uni.showToast({
						title:this.$t('index70'),// 请输入发送地址
						icon:"none"
					})
					return
				}
				if(!this.price){
					uni.showToast({
						title:this.$t('index72'),// 请输入互转金额
						icon:"none"
					})
					return
				}
				this.$api.post('/data/api.auth.invest/transfer',{
					price: this.price,
					address: this.address
				}).then(res=>{
					uni.showToast({
						title:this.$t('index74')// 互转成功
					})
					setTimeout(()=>{
						this.$refs.navbar.navBack()
					},1200)
				})
			}
		}
	}
</script>

<style lang="scss">
.with-card{
	padding: 30rpx;
	border-radius: 20rpx;
	background-color: #15151B;
}
</style>